// Calc Average of array of values.
// Date 12:37 29/10/2016
// By Ben a.k.a DreamVB

#include <iostream>

using namespace std;
using std::cout;
using std::endl;

double Average(double data[], int size){
	int sum(0);
	for (int i = 0; i < size; i++){
		sum += data[i];
	}
	return sum / size;
}

int main(int argc, char *argv[]){
	double vals[] = { 1.5,2.5, 3.5, 4.4, 5.5, 6.5 };
	int len = sizeof(vals) / sizeof(double);
	int i = 0;

	while (i < len){
		cout << vals[i] << " ";
		i++;
	}
	//Calc average.
	cout << endl << "Average: " << Average(vals, len) << endl;

	system("pause");
	return 0;
}